package com.agileboot.admin.controller.airport;

import com.agileboot.common.core.base.BaseController;
import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.domain.airport.dashboard.SirDashBoardApplicationService;
import com.agileboot.domain.airport.dashboard.db.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 仪表盘数据接口控制器
 *
 * @author valarchie
 */
@Tag(name = "仪表盘API", description = "仪表盘统计数据相关接口")
@RestController
@RequestMapping("/safety/dashboard")
@Validated
@RequiredArgsConstructor
public class SirDashboardController extends BaseController {

    private final SirDashBoardApplicationService dashBoardApplicationService;


    /**
     * 获取所有仪表盘汇总数据
     */
    @Operation(summary = "获取仪表盘汇总数据", description = "合并所有仪表盘统计数据的汇总接口")
    @GetMapping("/summary")
    public ResponseDTO<DashboardSummaryDTO> getDashboardSummary() {
        DashboardSummaryDTO summary = new DashboardSummaryDTO();
        summary.setInspectionSummary(dashBoardApplicationService.getInspectionSummary());
        summary.setWeeklyChecks(dashBoardApplicationService.getWeeklyCheckStatistics());
        summary.setWeeklyCompliance(dashBoardApplicationService.getWeeklyComplianceStatistics());
        summary.setDailySummary(dashBoardApplicationService.getDailySummaryForLast30Days());
        summary.setRecentActivities(dashBoardApplicationService.getRecentActivities());
        return ResponseDTO.ok(summary);
    }


}